﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;

namespace EXAM.Admin.Page_Admin.Windows
{
    public partial class frmCreateTest : System.Web.UI.Page
    {
        string _db = "EXA";
        string _cate = "Q0";
        string sErr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BUS.QuestionControl Qctr = new BUS.QuestionControl();
                DataTable dt = Qctr.GetByANALName(_cate, ref sErr);

                //BUS.SSRFANVControl ctr = new BUS.SSRFANVControl();
                //dgvList.DataSource = ctr.GetCategory_SSRFANV(_db, _cate, ref sErr);
                dgvList.DataSource = dt;
                dgvList.DataBind();

            }

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            string para = "";
            foreach (GridViewRow row in dgvList.Rows)
            {
                string code = row.Cells[0].Text;
                string value = ((TextBox)row.FindControl("txtNum")).Text;
                if (Regex.IsMatch(value, @"^[0-9]+$") && Convert.ToInt32(value) > 0)
                    para += ";" + code + ":" + value;
            }
            if (para.Length > 1)
                Response.Write(" <script type='text/javascript'> returnToParent('" + para.Substring(1) + "'); </script>");
            else Response.Write(" <script type='text/javascript'> returnToParent(''); </script>");
        }


    }
}
